<!--@author vidy3587@gmail.com-->
<template>
  <div class="navigator">
    <button @click="onBackClick" class="back-btn btn plain-btn" >
      <van-icon color="#fff" name="arrow-left"></van-icon>
    </button>
    <div class="navigator-title">
      <slot></slot>
    </div>
  </div>
</template>

<script>
export default {
  name: "navigator",
  props: {
    backClick: {
      type: Function,
      default: null
    }
  },
  methods: {
    onBackClick () {
      if (this.backClick) {
        this.backClick();
        return;
      }
      this.$router.back();
    }
  }
}
</script>

<style scoped lang="scss">
.navigator {
  position: relative;
  width: 100%;
  height: px2rem(86px);
  .back-btn {
    position: absolute;
    left: 0;
    top: 0;
    height: px2rem(86px);
  }
}

.navigator-title {
  box-sizing: border-box;
  width: 100%;
  display: flex;
  align-items: center;
  height: px2rem(86px);
  justify-content: center;
  padding: 0 px2rem(100px);
  color: $lightFontColor;
  font-size: px2rem(30px);
}
</style>